using System;

namespace SG3L_RAG.Domain.Entities
{
    public class Log : EntityBase
    {
        public string Type { get; private set; } = string.Empty;
        public string Content { get; private set; } = string.Empty;

        public string? ExceptionDetail { get; private set; }

        // EF Core 需要的无参构造函数
        public Log() { }

        // 业务构造函数
        private Log(string type, string content, string? exceptionDetail = null)
        {
            Type = type;
            Content = content;
            ExceptionDetail = exceptionDetail;
            CreatedAt = DateTime.UtcNow;
        }

        // 工厂方法
        public static Log Create(string type, string content, string? exceptionDetail = null)
        {
            return new Log(type, content, exceptionDetail);
        }

        public bool IsError() => Type == "error";
        public bool IsInfo() => Type == "info";
        public bool IsWarning() => Type == "warning";
        public bool IsDebug() => Type == "debug";
    }
}
